<template>
  <div class="home">
    <!-- 头部模块 -->
    <HeaderComponent :swipeData="modelData[0]"></HeaderComponent>
    <!-- 十个商品模块 -->
    <ProductComponent :productData="modelData[1]"></ProductComponent>
    <!-- 多个模块 -->
    <CommodityZone :iPhoneAll="modelData[2]" :swipeData="modelData[3]" :model1="modelData[4]" :model2="modelData[5]"
      :model3="modelData[6]"></CommodityZone>
    <WaterNavBar></WaterNavBar>
    <!-- 热门推荐和电脑平板 -->
    <HomeWaterfall></HomeWaterfall>
  </div>
</template>
<script>
import eventBus from "@/common/event-bus";
import ProductComponent from "@/components/Home/ProductComponent.vue";
import CommodityZone from "@/components/Home/CommodityZone.vue";
import HeaderComponent from "@/components/Home/HeaderComponent.vue";
import HomeWaterfall from "@/components/Home/HomeWaterfall.vue";
import WaterNavBar from "@/components/Home/WaterNavBar.vue";
export default {
  name: 'HomeView',
  components: {
    ProductComponent,
    CommodityZone,
    HeaderComponent,
    HomeWaterfall,
    WaterNavBar
  },
  data() {
    return {
      modelData: [],
    }
  },
  created() {
    this.getModelData();
    eventBus.$emit("correctPath", window.location.pathname);//NavigationBar.vue
  },
  methods: {
    getModelData() {
      this.$sendGet("Index/index")
        .then(res => {
          if (res.data.status === 200)
            this.modelData.push(...res.data.data.data);
        })
    },
  }
}
</script>